Imports cmplib01

Public Class frmAddElementClass
    Inherits System.Windows.Forms.Form

    Private ptrNewItem As ElementClass

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents btnOK As System.Windows.Forms.Button
    Friend WithEvents pnlElementClasses As System.Windows.Forms.Panel
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents lblElementClassName As System.Windows.Forms.Label
    Friend WithEvents txtElementClassDescription As System.Windows.Forms.TextBox
    Friend WithEvents txtElementClassName As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmAddElementClass))
        Me.btnOK = New System.Windows.Forms.Button()
        Me.pnlElementClasses = New System.Windows.Forms.Panel()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.lblElementClassName = New System.Windows.Forms.Label()
        Me.txtElementClassDescription = New System.Windows.Forms.TextBox()
        Me.txtElementClassName = New System.Windows.Forms.TextBox()
        Me.pnlElementClasses.SuspendLayout()
        Me.SuspendLayout()
        '
        'btnOK
        '
        Me.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnOK.Location = New System.Drawing.Point(184, 176)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.TabIndex = 12
        Me.btnOK.Text = "OK"
        '
        'pnlElementClasses
        '
        Me.pnlElementClasses.BackColor = System.Drawing.SystemColors.ControlLight
        Me.pnlElementClasses.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.pnlElementClasses.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.lblElementClassName, Me.txtElementClassDescription, Me.txtElementClassName})
        Me.pnlElementClasses.Location = New System.Drawing.Point(8, 8)
        Me.pnlElementClasses.Name = "pnlElementClasses"
        Me.pnlElementClasses.Size = New System.Drawing.Size(256, 160)
        Me.pnlElementClasses.TabIndex = 11
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(8, 56)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(184, 16)
        Me.Label2.TabIndex = 9
        Me.Label2.Text = "Description"
        '
        'lblElementClassName
        '
        Me.lblElementClassName.Location = New System.Drawing.Point(8, 8)
        Me.lblElementClassName.Name = "lblElementClassName"
        Me.lblElementClassName.Size = New System.Drawing.Size(184, 16)
        Me.lblElementClassName.TabIndex = 8
        Me.lblElementClassName.Text = "Element Class Name"
        '
        'txtElementClassDescription
        '
        Me.txtElementClassDescription.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtElementClassDescription.Location = New System.Drawing.Point(8, 80)
        Me.txtElementClassDescription.Multiline = True
        Me.txtElementClassDescription.Name = "txtElementClassDescription"
        Me.txtElementClassDescription.Size = New System.Drawing.Size(240, 72)
        Me.txtElementClassDescription.TabIndex = 7
        Me.txtElementClassDescription.Text = "New Element Class Description"
        '
        'txtElementClassName
        '
        Me.txtElementClassName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtElementClassName.Location = New System.Drawing.Point(8, 32)
        Me.txtElementClassName.Name = "txtElementClassName"
        Me.txtElementClassName.Size = New System.Drawing.Size(240, 20)
        Me.txtElementClassName.TabIndex = 6
        Me.txtElementClassName.Text = "New Element Class"
        '
        'frmAddElementClass
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(272, 208)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnOK, Me.pnlElementClasses})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmAddElementClass"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Element Classes"
        Me.pnlElementClasses.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public Sub New(ByRef NewItem As ElementClass)

        Me.New()

        ptrNewItem = NewItem

        PopulateProperties()

    End Sub

    Private Sub PopulateProperties()
        txtElementClassName.Text = ptrNewItem.ElementClassName
        txtElementClassDescription.Text = ptrNewItem.ElementClassDescription
    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        ' set the properties back into the object
        Try
            ptrNewItem.ElementClassName = txtElementClassName.Text
            ptrNewItem.ElementClassDescription = txtElementClassDescription.Text
        Catch
            ' shit
        End Try

        Me.Hide()
    End Sub

End Class
